<template>
  <div class="top">
    <span>
      <slot name="title"></slot>
    </span>
    <i>
      {{ time.start }} ~ {{ time.end }}
    </i>
  </div>
</template>

<script>
export default {
  name: 'Dkd2TopTime',
  data () {
    return {
      time: {
        start: '',
        end: ''
      }
    }
  },

  mounted () {
    this.getTime()
  },

  methods: {
    getTime () {
      const firstDayOfMonth = this.$moment().startOf('month')
      this.time.start = this.$moment(firstDayOfMonth).format('YYYY.MM.DD')
      this.time.end = this.$moment(new Date()).format('YYYY.MM.DD')
      // console.log(this.time.start)
      // console.log(this.time.end)
    }
  }
}
</script>

<style lang="less" scoped>
.top {
  text-align: left;
  span {
    color: #333;
    font-weight: 600;
    margin-right: 10px;
  }
  i {
    font-size: 12px;
    color: #999;
  }
}
</style>
